package com.di.base.service;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

@LocalTCC
public interface StorageTccService {

    @TwoPhaseBusinessAction(name = "StorageTccService", commitMethod = "commitDecrease", rollbackMethod = "rollbackDecrease")
    boolean prepareDecrease(BusinessActionContext context,
                            @BusinessActionContextParameter(paramName = "productId") String productId,
                            @BusinessActionContextParameter(paramName = "count") Integer count);

    boolean commitDecrease(BusinessActionContext context);

    boolean rollbackDecrease(BusinessActionContext context);
}
